const COMPREIFX = 'yqd-'
module.exports = {
  jsFile: (type, name) => {
    type = type.replace('-', '_').toUpperCase()
    const file = `import { COMPREIFX, INDENTIFICATION } from "../../../libs/const/widget";
export const JSON = {
      type: \`\${COMPREIFX}${name}\`,
      sign: INDENTIFICATION.${type},
      style: {
        width: "",
        height: "",
        position: "relative",
        left: 0,
        right: 0,
        top: 0,
        bottom: 0,
        borderRadius: "",
      },
      attribute: {
        text: "默认按钮",
        type: "primary",
      },
      events: {},
      items: [],
    };
    export const CONFIG = {
      sign: INDENTIFICATION.${type},
      type: \`\${COMPREIFX}${name}\`,
      name: "基础按钮",
      icon: "https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg",
      path: \`/components/\${COMPREIFX}${name}/index.vue\`,
    };
    
    export default {
      JSON,
      CONFIG,
    };`
    return new Buffer.from(file)
  },
  vueFile: (name) => {
    const file = `<template>
    <view :style="[styles]">
    </view>
</template>

<script>
import { COMPREIFX } from "../../../libs/const/widget";

export default {
    name: \`\${COMPREIFX}${name}\`,
    props: {
        attribute: Object,
        styles: Object,
    },
};
</script>

<style scoped>
</style>
`
    return new Buffer.from(file)
  }
}